// 解析地址
export function parseUrl (url) {
  const obj = {}
  const arr = url.substr(url.indexOf('?') + 1).split('&')
  arr.forEach(function (item) {
    const tmp = item.split('=')
    obj[tmp[0]] = tmp[1]
  })
  return obj
}
//
export function pick (obj, value) {
  const result = {}
  const fields = Array.isArray(value) ? value : [value]
  const keys = Reflect.ownKeys(obj)
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i]
    if (!value || fields.includes(key)) {
      result[key] = obj[key]
    }
  }
  return result
}
